<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2"><span style="color: red;font-size: 15px">*</span>{:__('咨询项目名称')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-project_name" data-rule="required" class="form-control" name="row[project_name]" type="text" value="{$row.project_name|htmlentities}">
        </div>
    </div>

    <div class="form-group">
        <label for="c-pid" class="control-label col-xs-12 col-sm-2">{:__('分类')}:</label>
        <div class="col-xs-12 col-sm-8">
            <select id="c-pid" data-rule="required" class="form-control selectpicker" name="row[category_id]">
                {foreach $categorys as $index=>$vo}
                <option data-type="status" value="{$vo.id}" {if condition="$row.category_id==$vo.id"} selected {/if} >{$vo.name}</option>
                {/foreach}
            </select>
        </div>
    </div>
    {foreach $rows as $index=>$vo}
    <div id="bao">
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2"><span style="color: red;font-size: 15px">*</span>{:__('检查报告')}:</label>
            <div class="col-xs-12 col-sm-4">
                <input id="c-report" class="form-control" data-rule="required" name="row[report][{$vo.id}]" type="text" value="{$vo.report_name}">
            </div>

            <div class="col-sm-3">
                <input type="radio" name="row[status][{$vo.id}]" value="0" {if condition="$vo.status=='0'"} checked {/if}>选择携带
                <input type="radio" name="row[status][{$vo.id}]" value="1" {if condition="$vo.status=='1'"} checked {/if}>必须携带
            </div>

            <div class="col-sm-2">
                <input class="btn btn-sm btn-danger btn-remove" type="button" onclick="news23(this)" id="news" value="删除" />
            </div>

        </div>
    </div>
    {/foreach}


    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>
<div >
    <input class="btn btn-sm btn-success btn-append" type="button" id="new" value="新增" />
</div>

<script src="/assets/img/jquery-3.4.1.min.js"></script>

<script>

    var x = 0;
    $('#new').click(function(){
        x=x+1;
        let html = `<div id="bao"><div class="form-group">
        <label class="control-label col-xs-12 col-sm-2"><span style="color: red;font-size: 15px">*</span>{:__('检查报告')}:</label>
        <div class="col-xs-12 col-sm-4">
            <input id="c-report-`+x+`" data-rule="required" class="form-control" name="row[reports][]" type="text" value="">
        </div>

        <div class="col-sm-3">
               <input type="radio" name="row[statuss][`+x+`]" value="0" checked>选择携带
            <input type="radio" name="row[statuss][`+x+`]" value="1">必须携带
        </div>

        <div class="col-sm-2">
            <input class="btn btn-sm btn-danger btn-remove" type="button" onclick="news23(this)" id="news" value="删除" />
        </div>

    </div></div>`
        $("#edit-form").append(html)
    });
    function news23(that){
        $(that).parents("#bao").remove();
    }
</script>
